#/bin/sh
disk_info_dir="/dev/shm/zstorage"
get_stat="cat ${disk_info_dir}/disk_stat.dat"
device=$1
item=$2

case $item in
        rrqm)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $2}'
            ;;
        wrqm)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $3}'
            ;;
        rps)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $4}'
            ;;
        wps)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $5}'
            ;;
        rKBps)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $6}'
            ;;
        wKBps)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $7}'
            ;;
        avgrq-sz)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $8}'
            ;;
        avgqu-sz)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $9}'
            ;;
        await)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $10}'
            ;;
        svctm)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $11}'
            ;;
        util)
            flock -s -o -w 3 ${disk_info_dir}/disk_stat.lock -c "$get_stat"|grep "\b$device\b" |tail -1|awk '{print $12}'
            ;;
	onlien)
           cat /proc/diskstats |grep "\b$device\b" |wc -l
           ;;
esac

